#include "BossRoom.hh"
#include <iostream>

BossRoom::BossRoom(const std::string& name, const std::string& description)
    : MonsterRoom(name, description) {}

bool BossRoom::hasWon()const{
    return win;
}
void BossRoom::enterRoom(Player& player) {
    // 向房间中添加最终Boss敌人
    // Add the final boss to the room
    enemies.push_back(getFinalBoss());
    std::cout << "\nYou've entered the Boss Room.And you can NEVER escape: " << getName() << "\n";
    descriptionText();//Show description of Boss Room

    // 如果boss还活着，战斗
    if (hasEnemies()) {
        Enemy& boss = enemies[0];
        std::cout << ">> Boss Appears: " << boss.toString() << "\n";

        player * boss;

        if (player.isAlive()) {
            if(!(boss.isAlive())){
                std::cout << "\nYou defeated the boss! You won the game!\n";
                win=true;// 玩家胜利，设置胜利标志 The player win the battle
            }
        } else {
            std::cout << "You were defeated by the boss...\n";
        }

        enemies.clear();//Win or Lost
    } else {
        std::cout << "The boss has already been defeated.\n";
    }
}
